import React, { Component } from 'react'
import { Redirect } from 'react-router-dom'

function auth(Com) {
    return class NewCom extends Component {
        render() {
            // 根据本地存储来判断
            if (sessionStorage.getItem('token')) {
                return (
                    <div className="h100">
                        <Com />
                    </div>
                )
            } else {
                return (
                    <Redirect to="/login"/>
                )
            }
        }
    }

}

export {
    auth
}